﻿using Prism.Events;
using Prism.Ioc;
using Prism.Mvvm;
using Prism.Regions;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TransformerSystem.Device;

namespace TransformerSystem.Core
{
    /// <summary>
    /// VM基类
    /// </summary>
    public abstract class ViewModelBase : BindableBase
    {
        /// <summary>
        /// 导航器
        /// </summary>
        public readonly IRegionManager Region;
        /// <summary>
        /// 弹窗服务
        /// </summary>
        public readonly IDialogService Dialog;
        /// <summary>
        /// 事件聚合器
        /// </summary>
        public readonly IEventAggregator Event;
        /// <summary>
        /// 日志服务
        /// </summary>
        public readonly ILoggerService Logger;
        /// <summary>
        /// 设备服务
        /// </summary>
        public readonly IDeviceService Device;
        /// <summary>
        /// 多语言服务
        /// </summary>
        public readonly ILanguageService Language;
        public ViewModelBase(IContainerExtension container)
        {
            Region = container.Resolve<IRegionManager>();
            Dialog = container.Resolve<IDialogService>();
            Event = container.Resolve<IEventAggregator>();
            Logger= container.Resolve<ILoggerService>();
            Language = container.Resolve<ILanguageService>();
        }
    }
}
